package com.ruoyi.web.controller.bid;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.bid.domain.TBidTemplateFillParam;
import com.ruoyi.bid.service.ITBidTemplateFillParamService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 标书填充参数列表Controller
 * 
 * @author AGAiChiChaoFen
 * @date 2024-11-15
 */
@RestController
@RequestMapping("/bid/param")
public class TBidTemplateFillParamController extends BaseController
{
    @Autowired
    private ITBidTemplateFillParamService tBidTemplateFillParamService;

    /**
     * 查询标书填充参数列表列表
     */
    @PreAuthorize("@ss.hasPermi('bid:param:list')")
    @GetMapping("/list")
    public TableDataInfo list(TBidTemplateFillParam tBidTemplateFillParam)
    {
        startPage();
        List<TBidTemplateFillParam> list = tBidTemplateFillParamService.selectTBidTemplateFillParamList(tBidTemplateFillParam);
        return getDataTable(list);
    }

    /**
     * 导出标书填充参数列表列表
     */
    @PreAuthorize("@ss.hasPermi('bid:param:export')")
    @Log(title = "标书填充参数列表", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TBidTemplateFillParam tBidTemplateFillParam)
    {
        List<TBidTemplateFillParam> list = tBidTemplateFillParamService.selectTBidTemplateFillParamList(tBidTemplateFillParam);
        ExcelUtil<TBidTemplateFillParam> util = new ExcelUtil<TBidTemplateFillParam>(TBidTemplateFillParam.class);
        util.exportExcel(response, list, "标书填充参数列表数据");
    }

    /**
     * 获取标书填充参数列表详细信息
     */
    @PreAuthorize("@ss.hasPermi('bid:param:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tBidTemplateFillParamService.selectTBidTemplateFillParamById(id));
    }

    /**
     * 新增标书填充参数列表
     */
    @PreAuthorize("@ss.hasPermi('bid:param:add')")
    @Log(title = "标书填充参数列表", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TBidTemplateFillParam tBidTemplateFillParam)
    {
        return toAjax(tBidTemplateFillParamService.insertTBidTemplateFillParam(tBidTemplateFillParam));
    }

    /**
     * 修改标书填充参数列表
     */
    @PreAuthorize("@ss.hasPermi('bid:param:edit')")
    @Log(title = "标书填充参数列表", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TBidTemplateFillParam tBidTemplateFillParam)
    {
        return toAjax(tBidTemplateFillParamService.updateTBidTemplateFillParam(tBidTemplateFillParam));
    }

    /**
     * 删除标书填充参数列表
     */
    @PreAuthorize("@ss.hasPermi('bid:param:remove')")
    @Log(title = "标书填充参数列表", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tBidTemplateFillParamService.deleteTBidTemplateFillParamByIds(ids));
    }
}
